Skip to content

feat: IP restriction#6221

Open
qxo wants to merge 3 commits intomudler:masterfrom
qxo:feat-webui-ip-limit
Open

feat: IP restriction#6221
qxo wants to merge 3 commits intomudler:masterfrom
qxo:feat-webui-ip-limit

Conversation

@qxo
Copy link
Copy Markdown
Contributor

@qxo qxo commented Sep 8, 2025

ie:
'''
LOCALAI_IP_ALLOWLIST=192.168.1.0/24,10.0.0.1,127.0.0.1 '''

Description

This PR fixes #

Notes for Reviewers

Signed commits

  • Yes, I signed my commits.

@netlify
Copy link
Copy Markdown

netlify bot commented Sep 8, 2025

Deploy Preview for localai ready!

Name Link
🔨 Latest commit 56697eb
🔍 Latest deploy log https://app.netlify.com/projects/localai/deploys/69b003e09628b60007537a0d
😎 Deploy Preview https://deploy-preview-6221--localai.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@@ -0,0 +1,100 @@
package utils
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks better placed as ipallowlist.go file inside core/http rather than having it's own utils package.

@github-actions
Copy link
Copy Markdown
Contributor

This PR is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@github-actions github-actions bot added Stale and removed Stale labels Dec 11, 2025
core/http/app.go Outdated
}

//IP restriction
router.Use(func(c *fiber.Ctx) error {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to register this if any IP was actually specified. No need to register otherwise another handler

ie:
'''
LOCALAI_IP_ALLOWLIST=192.168.1.0/24,10.0.0.1,127.0.0.1
'''
@qxo qxo force-pushed the feat-webui-ip-limit branch from 0342f17 to 229b719 Compare March 10, 2026 11:21
Copy link
Copy Markdown
Owner

@mudler mudler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e.Use(middleware.Recover())
}

// IP restriction middleware
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this would better be suited as a middleware indeed to avoid spreading the logic in utils packages, instead of being registered here.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants